home *** CD-ROM | disk | FTP | other *** search
/ PC Media 23 / PC MEDIA CD23.iso / share / prog / pcl4w12 / pcl4wref.doc < prev    next >
Text File  |  1995-08-07  |  52KB  |  1,497 lines

  1.  
  2.  
  3.                   Personal Communications Library
  4.  
  5.                           For Windows
  6.  
  7.  
  8.                              (PCL4W)
  9.  
  10.  
  11.  
  12.                         REFERENCE MANUAL
  13.  
  14.  
  15.  
  16.  
  17.  
  18.                           Version 1.2
  19.  
  20.                          August 8, 1995
  21.  
  22.  
  23.  
  24.  
  25.                   This software is provided as-is.
  26.            There are no warranties, expressed or implied.
  27.  
  28.  
  29.  
  30.  
  31.                         Copyright (C) 1995
  32.                         All rights reserved
  33.  
  34.  
  35.  
  36.                   MarshallSoft Computing, Inc.
  37.                       Post Office Box 4543
  38.                       Huntsville AL 35815
  39.  
  40.                        Voice  205-881-4630
  41.                        FAX    205-880-0925
  42.                        BBS    205-880-9748
  43.                      email  msc@traveller.com
  44.  
  45.  
  46.                            _______
  47.                       ____|__     |                (R)
  48.                    --+       |    +-------------------
  49.                      |   ____|__  |  Association of
  50.                      |  |       |_|  Shareware
  51.                      |__|   o   |    Professionals
  52.                    --+--+   |   +---------------------
  53.                         |___|___|    MEMBER
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  PCL4W Reference Manual                                            Page 1
  69.                           T A B L E
  70.  
  71.                              O F
  72.  
  73.                         C O N T E N T S
  74.  
  75.  
  76.  
  77.  
  78.     Chapter                                          Page
  79.  
  80.     Table of Contents..................................2
  81.     Introduction.......................................3
  82.        SioBaud.........................................4
  83.        SioBrkSig.......................................4
  84.        SioCTS..........................................5
  85.        SioDCD..........................................5
  86.        SioDone.........................................6
  87.        SioDSR..........................................6
  88.        SioDTR..........................................7
  89.        SioFIFO.........................................7
  90.        SioFlow.........................................8
  91.        SioGetc.........................................8
  92.        SioGetDiv.......................................9
  93.        SioInfo.........................................9
  94.        SioIRQ.........................................10
  95.        SioLine........................................10
  96.        SioLoopBack....................................11
  97.        SioModem.......................................11
  98.        SioParms.......................................12
  99.        SioPorts.......................................12
  100.        SioPutc........................................13
  101.        SioRead........................................13
  102.        SioReset.......................................14
  103.        SioRI..........................................14
  104.        SioRTS.........................................15
  105.        SioRxBuf.......................................15
  106.        SioRxFlush.....................................16
  107.        SioRxQue.......................................16
  108.        SioTxBuf.......................................17
  109.        SioTxFlush.....................................17
  110.        SioTxQue.......................................18
  111.        SioUART........................................18
  112.        SioUnGetc......................................19
  113.     Function Summary..................................20
  114.     Error Code Summary................................21
  115.     Code Examples.....................................21
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  PCL4W Reference Manual                                            Page 2
  137.                            Introduction
  138.  
  139.  
  140.  
  141.   This  manual  lists  all of the PCL4W functions in alphabetical order. Every
  142.   library function will return a value as follows:
  143.  
  144.   1.  Negative values for error conditions. See last page of this  manual  for
  145.       a list of error values and their meanings.
  146.  
  147.   2.  Non-negative values when returning data (eg: SioLine).
  148.  
  149.   3.  Zero otherwise.
  150.  
  151.   When debugging an application, be sure  to  test  all  return  values.   Use
  152.   SioError() (see file SIOERROR.C) to print the associated text for errors.
  153.  
  154.   Example Code Segment
  155.  
  156.  
  157.   +---------------------------------------------------------------+
  158.   | int Code;                 /* MUST be 'int', not 'char' */     |
  159.   |                                                               |
  160.   | Code = SioFunction( );    /* any PCL4W function */            |
  161.   | if(Code<0)                                                    |
  162.   |   {/* error returned */                                       |
  163.   |    SioError(Code);        /* SioError prints error text */    |
  164.   |    SioDone(Port);         /* always call SioDone last */      |
  165.   |    exit(1);                                                   |
  166.   |   }                                                           |
  167.   | /* no errors */                                               |
  168.   | ...your application code...                                   |
  169.   |                                                               |
  170.   +---------------------------------------------------------------+
  171.  
  172.  
  173.   The  program  SIMPLE is provided as a straight forward and simple example of
  174.   the use of the PCL4W library - at least as straight forward as  any  Windows
  175.   programming can be.
  176.  
  177.   Also look at the TERM program, which is distributed separately from PCL4W as
  178.   WTERM12.ZIP. Many PCL4W functions are used somewhere in TERM.  Other example
  179.   programs will be provided. Look for them on our User Support BBS.
  180.  
  181.   Also note that there are two versions of the library. One  version  is  with
  182.   transmitter interrupts disabled and one with transmitter interrupts enabled.
  183.  
  184.   Refer to the User's Manual (PCL4W.USR) for additional information.
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  PCL4W Reference Manual                                            Page 3
  205.   +-------------+------------------------------------------------------------+
  206.   |   SioBaud   |  Sets the baud rate of the selected port.                  |
  207.   +-------------+------------------------------------------------------------+
  208.  
  209.  
  210.     Syntax    int SioBaud(int Port,int BaudCode)
  211.               /* Port:      Port selected (COM1 - COM20) */
  212.               /* BaudCode:  Baud code */
  213.  
  214.    Remarks    The  SioBaud  function sets the baud rate without resetting  the
  215.               port. It is used to change the baud rate after calling SioReset.
  216.  
  217.                Code   Rate    Name             Code   Rate   Name
  218.                  0     300    Baud300            5    9600   Baud9600
  219.                  1     600    Baud600            6   19200   Baud19200
  220.                  2    1200    Baud1200           7   38400   Baud38400
  221.                  3    2400    Baud2400           8   57600   Baud57600
  222.                  4    4800    Baud4800           9  115200   Baud115200
  223.  
  224.  
  225.    Returns     -4 : No such port. Expect 0 to MaxPort.
  226.               -11 : Bad baud rate code. See above code values.
  227.  
  228.   See Also    SioReset
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.   +-------------+------------------------------------------------------------+
  238.   |  SioBrkSig  |  Asserts, cancels, or detects BREAK signal.                |
  239.   +-------------+------------------------------------------------------------+
  240.  
  241.  
  242.     Syntax    int SioBrkSig(int Port,char Cmd)
  243.               /* Port:      Port selected (COM1 thru COM20) */
  244.               /* char Cmd:  ASSERT, CANCEL, or DETECT */
  245.  
  246.    Remarks    The SioBrkSig function controls the BREAK bit in the line status
  247.               register. The legal commands are:
  248.  
  249.               ASSERT_BREAK ('A') to assert BREAK
  250.               CANCEL_BREAK ('C') to cancel BREAK
  251.               DETECT_BREAK ('D') to detect BREAK
  252.  
  253.               ASSERT_BREAK, CANCEL_BREAK,  and  DETECT_BREAK  are  defined  in
  254.               PCL4W.H. See TERM.C for an example of the use of SioBrkSig.
  255.  
  256.    Returns    -2 : Port not enabled. Call SioReset first.
  257.               -4 : No such port. Expect 0 to MaxPort.
  258.               -6 : Illegal command. Expected 'A', 'C', or 'D'.
  259.               >0 : BREAK signal detected (DETECT command only)
  260.  
  261.   See Also    N/A
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  PCL4W Reference Manual                                            Page 4
  273.   +-------------+------------------------------------------------------------+
  274.   |   SioCTS    |  Reads the Clear to Send (CTS) modem status bit.           |
  275.   +-------------+------------------------------------------------------------+
  276.  
  277.     Syntax    int SioCTS(int Port)
  278.               /* int Port: Port selected (COM1 thru COM20) */
  279.  
  280.    Remarks    The SioCTS function is used to read  the  Clear  to  Send  (CTS)
  281.               modem status bit.
  282.  
  283.               The  CTS  line  is  used  by  some  error  correcting  modems to
  284.               implement hardware flow control.  CTS is dropped by the modem to
  285.               signal the computer not to send data  and is  raised  to  signal
  286.               the computer to continue.
  287.  
  288.               Refer to the User's Manual for a discussion of flow control.
  289.  
  290.    Returns    -2 : Port not enabled. Call SioReset first.
  291.               -4 : No such port.  Expect 0 to MaxPort.
  292.                0 : CTS is clear.
  293.               >0 : CTS is set.
  294.  
  295.   See Also    SioFlow, SioDSR, SioRI, SioDCD, and SioModem.
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.   +-------------+------------------------------------------------------------+
  307.   |   SioDCD    |  Reads the Data Carrier Detect (DCD) modem staus bit.      |
  308.   +-------------+------------------------------------------------------------+
  309.  
  310.  
  311.     Syntax    int SioDCD(int Port)
  312.               /* Port: Port selected (COM1 thru COM20) */
  313.  
  314.    Remarks    The  SioDCD  function is  used to read the Data Carrier Detect
  315.               (DCD) modem status bit. Also see SioModem.
  316.  
  317.    Returns    -2 : Port not enabled. Call SioReset first.
  318.               -4 : No such port.  Expect 0 to MaxPort.
  319.                0 : DCD is clear.
  320.               >0 : DCD is set.
  321.  
  322.   See Also    SioDSR, SioCTS, SioRI, and SioModem.
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  PCL4W Reference Manual                                            Page 5
  341.   +-------------+------------------------------------------------------------+
  342.   |   SioDone   |  Terminates further serial processing.                     |
  343.   +-------------+------------------------------------------------------------+
  344.  
  345.  
  346.     Syntax    int SioDone(int Port)
  347.               /* Port: Port selected (COM1 thru COM20) */
  348.  
  349.    Remarks    The  SioDone  function  terminates  further  serial  processing.
  350.               SioDone  MUST  be called before exiting your application so that
  351.               interrupts can be restored to their original state.  Failure  to
  352.               do  this  can crash the operating system.  If you forget to call
  353.               SioDone before exiting, be sure to re-boot your  computer.   You
  354.               can  call SioDone even if SioReset has not been called, so it is
  355.               good  practice  to  always  call  SioDone  before  exiting  your
  356.               application.
  357.  
  358.               Also  note  that  SioDone  dereferences the transmit and receive
  359.               buffers set up by SioRxQue and SioTxQue.
  360.  
  361.    Returns    -2 : Port not enabled. Call SioReset first.
  362.               -4 : No such port. Expect 0 to MaxPort.
  363.  
  364.   See Also    SioReset.
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.   +-------------+------------------------------------------------------------+
  376.   |    SioDSR   |  Reads the Data Set Ready (DSR) modem status bit.          |
  377.   +-------------+------------------------------------------------------------+
  378.  
  379.  
  380.     Syntax    int SioDSR(int Port)
  381.               /* Port: Port selected (COM1 thru COM20) */
  382.  
  383.    Remarks    The SioDSR function is used to read the  Data  Set  Ready  (DSR)
  384.               modem status bit.  The DSR line is normally  used  by  a  serial
  385.               device  (such  as  a  modem)  to  signal the computer that it is
  386.               ready.
  387.  
  388.    Returns    -2 : Port not enabled. Call SioReset first.
  389.               -4 : No such port.  Expect 0 to MaxPort.
  390.                0 : DSR is clear.
  391.               >0 : DSR is set
  392.  
  393.   See Also    SioCTS, SioRI, SioDCD, and SioModem
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  PCL4W Reference Manual                                            Page 6
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  PCL4W Reference Manual                                            Page 7
  477.   +-------------+------------------------------------------------------------+
  478.   |    SioDTR   |  Set, clear, or read Data Terminal Ready (DTR) status bit. |
  479.   +-------------+------------------------------------------------------------+
  480.  
  481.  
  482.     Syntax    int SioDTR(int Port,char Cmd)
  483.               /* Port: Port selected (COM1 thru COM20) */
  484.               /* Cmd:  DTR command (SET, CLEAR, or READ) */
  485.  
  486.    Remarks    The SioDTR function controls the Data Terminal Ready (DTR) bit
  487.               in the modem control register.  DTR should always  be  set  when
  488.               communicating with a modem. Commands (defined in PCL4W.H) are:
  489.  
  490.               SET_LINE ('S')  to set DTR (ON)
  491.               CLEAR_LINE ('C')  to clear DTR (OFF)
  492.               READ_LINE ('R')  to read DTR
  493.  
  494.    Returns    -2 : Port not enabled. Call SioReset first.
  495.               -4 : No such port. Expect 0 to MaxPort.
  496.               -5 : Not one of 'S', 'C', or 'R'.
  497.                0 : DTR is OFF (READ_LINE Command).
  498.               >0 : DTR is ON (READ_LINE Command).
  499.  
  500.   See Also    SioRTS.
  501.  
  502.  
  503.  
  504.   +-------------+------------------------------------------------------------+
  505.   |   SioFIFO   |  Sets the FIFO trigger level (16550 UART only).            |
  506.   +-------------+------------------------------------------------------------+
  507.  
  508.  
  509.     Syntax    int SioFIFO(int Port,int LevelCode)
  510.               /* Port:      Port selected (COM1 thru COM20) */
  511.               /* LevelCode: FIFO level code (see below) */
  512.  
  513.    Remarks    The SioFIFO function  is  used to enable both transmit & receive
  514.               FIFOs for 16550 UARTS, and to set the  trigger  level  at  which
  515.               receive interrupts are generated.
  516.  
  517.               For  example, if the FIFO level is set to 8, then the 16550 UART
  518.               will not generate an interrupt until 8 bytes have been received.
  519.               This reduces the  number  of  interrupts  generated  and  allows
  520.               faster   processing   with   slower  machines  or  when  running
  521.               simultaneous ports.
  522.  
  523.               In order to take advantage of the TX FIFO, use the PCL4W library
  524.               with TX interrupts enabled.
  525.  
  526.               In order to test if your port is a 16550 UART, call SioFIFO with
  527.               a LevelCode of other than FIFO_OFF. SioFIFO can  be  called  for
  528.               the 8250 and 16450 UART without ill effect.
  529.  
  530.               Code  PCL4W.H Name  Trigger Level
  531.               -1      FIFO_OFF     Disable FIFO
  532.                0      LEVEL_1      1 byte
  533.                1      LEVEL_4      4 bytes
  534.                2      LEVEL_8      8 bytes
  535.                3      LEVEL_14     14 bytes
  536.  
  537.    Returns    -2 : Port not enabled. Call SioReset first.
  538.               -4 : No such port.  Expect 0 to MaxPort.
  539.               >0 : FIFO level set.
  540.                0 : FIFO level not set (not 16550).
  541.  
  542.  
  543.  
  544.  PCL4W Reference Manual                                            Page 8
  545.   +------------+-------------------------------------------------------------+
  546.   |   SioFlow  |  Sets hardware (RTS/CTS) flow control.                      |
  547.   +------------+-------------------------------------------------------------+
  548.  
  549.  
  550.     Syntax    int SioFlow(int Port,int Flag)
  551.               /* Port: Port selected (COM1 thru COM20) */
  552.               /* Flag: TRUE to enable flow control */
  553.  
  554.    Remarks    The SioFlow function is used to enable or disable hardware  flow
  555.               control.  Hardware flow control uses RTS and CTS to control data
  556.               flow  between  the  modem and the computer.  Refer to the User's
  557.               Manual  for  a  discussion  of flow control.  To enable hardware
  558.               flow control, call SioFlow with Flag=TRUE.
  559.  
  560.               In order for hardware flow control to work correctly, your modem
  561.               must also be configured to work with hardware flow control,  and
  562.               your  computer  to  modem  cable  must  have  RTS  and CTS wired
  563.               straight through. If you enable hardware flow  control,  do  not
  564.               modify  the  RTS  line  (by  calling  SioRTS)  unless  you  know
  565.               exactly what you are doing.
  566.  
  567.               Flow control is disabled after resetting a port.  To  explicitly
  568.               disable hardware flow control, call SioFlow with Flag=FALSE.
  569.  
  570.    Returns    -2 : Port not enabled. Call SioReset first.
  571.               -4 : No such port.  Expect 0 to MaxPort.
  572.               =0 : Flow control disabled.
  573.               >0 : Flow control enabled.
  574.  
  575.   See Also    SioPutc
  576.  
  577.  
  578.  
  579.  
  580.  
  581.   +------------+-------------------------------------------------------------+
  582.   |   SioGetc  |  Reads the next character from the serial line.             |
  583.   +------------+-------------------------------------------------------------+
  584.  
  585.  
  586.     Syntax    int SioGetc(int Port)
  587.               /* Port: Port selected (COM1 thru COM20) */
  588.  
  589.    Remarks    The SioGetc function reads a byte from the selected serial port.
  590.               The function will return immediately if no serial byte is ready.
  591.  
  592.    Returns    -2 : Port not enabled. Call SioReset first.
  593.               -4 : No such port. Expect 0 to MaxPort.
  594.               -1 : If timed out.
  595.               >0 : Character read.
  596.  
  597.   See Also    SioUnGetc and SioPutc.
  598.  
  599.  
  600.  
  601.  
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  PCL4W Reference Manual                                            Page 9
  613.   +---------------+----------------------------------------------------------+
  614.   |   SioGetDiv   |  Reads the baud rate divisor.                            |
  615.   +---------------+----------------------------------------------------------+
  616.  
  617.  
  618.     Syntax    int SioGetDiv(int Port)
  619.               /* Port: Port selected (COM1 thru COM20) */
  620.  
  621.  
  622.    Remarks     The  SioGetDiv  function reads the baud rate divisor. The baud
  623.               rate can then be determined by the divisor:
  624.  
  625.               Baud   Divisor      Baud  Divisor      Baud  Divisor
  626.                300    0180        4800   0018       38400   0003
  627.               1200    0060        9600   000C       57600   0002
  628.               2400    0030       19200   0006      115200   0001
  629.  
  630.    Returns    -2 : Port not enabled. Call SioReset first.
  631.               -4 : No such port. Expect 0 to MaxPort.
  632.               >0 : Baud rate divisor.
  633.  
  634.   See Also    SioParms.
  635.  
  636.  
  637.  
  638.   +-------------+------------------------------------------------------------+
  639.   |   SioInfo   |  Returns PCL4W library information.                        |
  640.   +-------------+------------------------------------------------------------+
  641.  
  642.  
  643.     Syntax    int SioInfo(char Cmd)
  644.               /* Cmd: Command ('V', 'I', 'T', 'R') */
  645.  
  646.    Remarks    The  SioInfo  function returns an integer code  corresponding to
  647.               either the (1) library version number,  (2)  whether  or  not
  648.               transmitter   interrupts   are   enabled,   (3)  the  number  of
  649.               transmitter  interrupts,  and  (4)  the   number   of   receiver
  650.               interrupts.
  651.  
  652.  
  653.    Returns    Version ('V')
  654.  
  655.               hex byte XY where version is denoted as X.Y
  656.  
  657.               TX Interrupts ('I')
  658.  
  659.               TRUE  if  transmitter  interrupts  are  enabled  in the library,
  660.               otherwise FALSE.
  661.  
  662.               TX Interrupts Generated ('T')
  663.  
  664.               Returns the total number of  transmitter  interrupts  generated.
  665.               This will be 0 unless transmitter interrupts are enabled.
  666.  
  667.               RX Interrupts Generated ('R')
  668.  
  669.               Returns  the  total  number of receiver interrupts generated.
  670.  
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  PCL4W Reference Manual                                            Page 10
  681.   +-------------+------------------------------------------------------------+
  682.   |    SioIRQ   |  Assigns an IRQ line to a port.                            |
  683.   +-------------+------------------------------------------------------------+
  684.  
  685.  
  686.     Syntax    int SioIRQ(int Port,intIRQcode)
  687.               /* Port:    Port selected (COM1 thru COM20) */
  688.               /* IRQcode: IRQ number [IRQ2..IRQ15] */
  689.  
  690.    Remarks    The SioIRQ function assigns an IRQ line to  a  port.   That  is,
  691.               SioIRQ  maps  an  IRQ  to a port.  SioIRQ (like SioUART) must be
  692.               called before calling SioReset. Unless you have  a  non-standard
  693.               (COM1  &  COM3  use IRQ4 while COM2 & COM4 use IRQ3) serial port
  694.               configuration  (or  don't  want  to  run  more  than   2   ports
  695.               concurrently),  you  will not need to call SioIRQ.  Be EXTREMELY
  696.               careful with SioIRQ as it can lock  your  machine  up  if  given
  697.               incorrect information.
  698.  
  699.               In  particular,  remember  that your port hardware must generate
  700.               the interrupt that you have specified.  You should refer to your
  701.               serial  board  hardware  manual  for  specfic  instructions   in
  702.               configuring  your  hardware.  Be  sure to call SioPorts first to
  703.               setup DigiBoard ports if you have  them.   Refer  to  the  PCL4W
  704.               Users Manual for additional information.
  705.  
  706.  
  707.    Returns    -4 : No such port. Expect 0 to MaxPort.
  708.              -15 : Port already enabled.  SioReset has already been called.
  709.               -7 : No such IRQ.
  710.              -18 : ISR limit (maximum of 4 PC IRQs) exceeded.
  711.                0 : Otherwise
  712.  
  713.   See Also    SioUART and SioPorts.
  714.  
  715.  
  716.  
  717.  
  718.  
  719.   +-------------+------------------------------------------------------------+
  720.   |   SioLine   |  Reads the line status register.                           |
  721.   +-------------+------------------------------------------------------------+
  722.  
  723.  
  724.     Syntax    int SioLine(int Port)
  725.               /* Port: Port selected (COM1 thru COM20) */
  726.  
  727.    Remarks    The  SioLine  function  reads  the  line  status  register.  The
  728.               individual bit masks are as follows:
  729.  
  730.               0x40  = Transmitter empty.
  731.               0x20  = Transmitter buffer empty.
  732.               0x10  = Break detected.
  733.               0x08  = Framming error.
  734.               0x04  = Parity error.
  735.               0x02  = Overrun error.
  736.               0x01  = Data ready.
  737.  
  738.               The above are documented in the file PCL4W.H.
  739.  
  740.    Returns    -2 : Port not enabled. Call SioReset first.
  741.               -4 : No such port. Expect 0 to MaxPort.
  742.               >0 : Line status (rightmost byte of word).
  743.  
  744.   See Also    SioModem.
  745.  
  746.  
  747.  
  748.  PCL4W Reference Manual                                            Page 11
  749.   +-------------+------------------------------------------------------------+
  750.   | SioLoopBack |  Does a UART loopback test.                                |
  751.   +-------------+------------------------------------------------------------+
  752.  
  753.  
  754.     Syntax    int SioLoopBack(int Port)
  755.               /* Port: Port selected (COM1 thru COM20) */
  756.  
  757.    Remarks    SioLoopBack makes use of the built in loopback  test  capability
  758.               of  the  INS8250  family  UART.  Normally SioLoopBack will never
  759.               need to be called unless you suspect that your UART is bad. Many
  760.               UARTs must be reset after running a loopback test.
  761.  
  762.    Returns      0 : Loopback test is successfull.
  763.                -2 : Port not enabled. Call SioReset first.
  764.                -4 : No such port.  Expect 0 to MaxPort.
  765.               -12 : Loopback test fails.
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.   +-------------+------------------------------------------------------------+
  778.   |   SioModem  |  Reads the modem status register.                          |
  779.   +-------------+------------------------------------------------------------+
  780.  
  781.  
  782.     Syntax    int SioModem(int Port, int Mask)
  783.               /* Port: Port selected (COM1 thru COM20) */
  784.               /* Mask: Modem function mask */
  785.  
  786.    Remarks    The  SioModem  function  reads  the  modem  register.    The bit
  787.               definitions for the function mask are as follows:
  788.  
  789.               Bit Name  Function               Bit  Name      Function
  790.                7  DCD   Data Carrier Detect     3   DeltaDCD  DCD has changed
  791.                6  RI    Ring Indicator          2   DeltaRI   RI has changed
  792.                5  DSR   Data Set Ready          1   DeltaDSR  DSR has changed
  793.                4  CTS   Clear To Send           0   DeltaCTS  CTS has changed
  794.  
  795.               Bits  4  through  7  represent  the  absolute  state  of   their
  796.               respective  RS-232  inputs.  Bits 0 through 3 represent a change
  797.               in the state of their respective RS-232 inputs since last  read.
  798.               Once UART register 3 is read, the Delta bits are cleared.  Thus,
  799.               it is best not to depend on the Delta bits.
  800.  
  801.  
  802.    Returns    -2 : Port not enabled. Call SioReset first.
  803.               -4 : No such port. Expect 0 to MaxPort.
  804.               >0 : Modem status (rightmost byte of word).
  805.  
  806.   See Also   SioCTS, SioDCD, SioDSR and SioRI.
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  PCL4W Reference Manual                                            Page 12
  817.   +-------------+------------------------------------------------------------+
  818.   |  SioParms   |  Sets parity, stop bits, and word length.                  |
  819.   +-------------+------------------------------------------------------------+
  820.  
  821.  
  822.    Syntax     int  SioParms(int Port,int Parity,int StopBits, int DataBits)
  823.               /* Port:     Port selected (COM1 - COM20) */
  824.               /* Parity:   Parity code [0,1,2] */
  825.               /* StopBits: Stop bits code [0,1] */
  826.               /* DataBits: Word length code [0,1,2,3] */
  827.  
  828.    Remarks    The SioParms function sets  the  parity,  stop  bits,  and  word
  829.               length.   If  the  default parity (none), stop bits (1), or word
  830.               length (8) is not  acceptable,  then  they  can  be  changed  by
  831.               calling SioParms.  SioParms can be called either before or after
  832.               calling SioReset. See file PCL4W.H. (8 = default)
  833.  
  834.                             Value   Description    PCL4W.H Name
  835.               ParityCode:    *0      no parity      NoParity
  836.                               1      odd parity     OddParity
  837.                               3      even parity    EvenParity
  838.               StopBitsCode:  *0      1 stop bit     OneStopBit
  839.                               1      2 stop bits    TwoStopBits
  840.               WordLengthCode: 0      5 data bits    WordLength5
  841.                               1      6 data bits    WordLength6
  842.                               2      7 data bits    WordLength7
  843.                              *3      8 data bits    WordLength8
  844.  
  845.   Returns     -4 : No such port. Expect 0 to MaxPort.
  846.               -7 : Bad parity code selected. Expecting  0 to 2.
  847.               -8 : Bad stop bits code. Expecting  0 or 1.
  848.               -9 : Bad word length code. Expecting  0 to 3.
  849.  
  850.  See Also    SioReset.
  851.  
  852.  
  853.   +-------------+------------------------------------------------------------+
  854.   |  SioPorts   |  Sets number of PC & Digiboard / BOCA Board ports.         |
  855.   +-------------+------------------------------------------------------------+
  856.  
  857.  
  858.     Syntax     int  SioPorts(int NbrPorts,int FirstPort,int StatusReg,
  859.                                int Code)
  860.               /* NbrPorts:  Total number of ports */
  861.               /* FirstPort: First DigiBoard port */
  862.               /* StatusReg: DigiBoard Status Register */
  863.               /* Code:      PC_PORTS, DIGIBOARD, or BOCABOARD */
  864.  
  865.    Remarks    The SioPorts function must be called  before  ANY  other  serial
  866.               functions.   The  purpose of the SioPorts function is to set the
  867.               total number of ports, the first DigiBoard (or BOCA board)  port
  868.               and the DigiBoard (or BOCA board) status register address.
  869.  
  870.               Once SioPorts is called, all COM ports starting with "FirstPort"
  871.               will be treated as DigiBoard (or BOCA board) ports.  The default
  872.               setup is 4 standard PC ports and no DigiBoard or  BOCA  ports  [
  873.               SioPorts(4,4,0,PC_PORTS) ].
  874.  
  875.               Refer  to  ther  PCL4W users maniual for more information on the
  876.               DigiBoard and BOCA board.
  877.  
  878.    Returns    -4 : No such port. Expect 0 to 9.
  879.               0 : No error (sets MaxPort to NumberPorts-1).
  880.  
  881.   See Also    SioUART, SioIRQ, and Code Examples.
  882.  
  883.  
  884.  PCL4W Reference Manual                                            Page 13
  885.   +-------------+------------------------------------------------------------+
  886.   |   SioPutc   |  Transmit a character over a serial line.                  |
  887.   +-------------+------------------------------------------------------------+
  888.  
  889.  
  890.     Syntax    int SioPutc(int Port,char Ch)
  891.               /* Port: Port selected (COM1 thru COM20) */
  892.               /* Ch:   Character to send */
  893.  
  894.    Remarks    The SioPutc function transmits one character  over the  selected
  895.               serial line.
  896.  
  897.               If  flow  control has been enabled, then SioPutc may return a -1
  898.               (time out) if the  number  of  tics  specified  in  the  SioFlow
  899.               function was exceeded waiting for the modem to raise CTS.
  900.  
  901.               Refer to the User's Manual for a discussion of flow control.
  902.  
  903.               If  transmitter  interrupts  are  enabled  (there  are  separate
  904.               versions of the library  for  transmitter  interrupts  enabled),
  905.               then  the  byte  is  placed  in  the  transmit  buffer, awaiting
  906.               transmission by the PCL4W interrupt service routine.
  907.  
  908.    Returns    -2 : Port not enabled. Call SioReset first.
  909.               -4 : No such port. Expect 0 to MaxPort.
  910.               -1 : Timed out waiting for CTS (flow control enabled)
  911.  
  912.   See Also    SioGetc and SioFlow.
  913.  
  914.  
  915.  
  916.  
  917.   +-------------+------------------------------------------------------------+
  918.   |   SioRead   |  Reads any UART register.                                  |
  919.   +-------------+------------------------------------------------------------+
  920.  
  921.  
  922.     Syntax    int SioRead(int Port,int Reg)
  923.               /* Port: Port selected (COM1 thru COM20) */
  924.               /* Reg:  UART register (0 to 7) */
  925.  
  926.    Remarks    The SioReset function directly reads the contents of any of  the
  927.               7  UART  registers.   This  function  is  useful  when debugging
  928.               application  programs  and  as  a  method  for  verifying   UART
  929.               contents.   Refer  to the PCL4W Users Manual for a discussion of
  930.               the 7 UART registers.
  931.  
  932.               The line status register (register 5)  can  also  be  read  with
  933.               SioLine while the modem status register (register 6) can also be
  934.               read  with  SioModem.  Refer  to  the  PCL4W User's Manual for a
  935.               discussion of the UART registers.
  936.  
  937.    Returns     -3 : No buffer available. Call SioRxBuf first.
  938.                -4 : No such port. Expect 0 to MaxPort.
  939.  
  940.   See Also    SioLine and SioModem.
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  PCL4W Reference Manual                                            Page 14
  953.   +-------------+------------------------------------------------------------+
  954.   |  SioReset   |  Initialize a serial port for processing.                  |
  955.   +-------------+------------------------------------------------------------+
  956.  
  957.  
  958.     Syntax    int SioReset(int Port,int BaudCode)
  959.               /* Port:     Port selected (COM1 thru COM20) */
  960.               /* BaudCode: Baud code or -1 */
  961.  
  962.    Remarks    The SioReset function  initializes  the  selected  serial  port.
  963.               SioReset should be called after calling SioParm and SioRxBuf but
  964.               before  making  any  other  calls  to  PCL4W.  SioReset uses the
  965.               parity, stop bits, and  word  length  value  previously  set  if
  966.               SioParm  was  called, otherwise the default values (see SioParm)
  967.               are used.
  968.  
  969.               Recall that COM1 and COM3 share the same  interrupt  vector  and
  970.               therefore  cannot  operate  simultaneously. Similiarly, COM2 and
  971.               COM4 cannot operate simultaneously. Any other combination of two
  972.               ports can be used.
  973.  
  974.               By specifing NORESET (-1) for the baud rate code, the port  will
  975.               NOT  be  reset.   This is used to "take over" a port from a host
  976.               communications program that allows a  "DOS  gateway".   External
  977.               protocols  can  be implemented this way.  See SioBaud for a list
  978.               of the baud rate codes, or see "PCL4W.H".
  979.  
  980.    Returns     -3 : No buffer available. Call SioRxBuf first.
  981.                -4 : No such port. Expect 0 to MaxPort.
  982.               -11 : Bad baud rate code selected. Expecting  0 to 9.
  983.               -13 : UART undefined.  SioUART(Port,0) was called previously.
  984.               -14 : Bad or missing UART.  You may not have hardware present.
  985.               -15 : Port already enabled.  SioReset has already been called.
  986.               -16 : Interrupt already in use.
  987.  
  988.   See Also    SioBaud, SioParms, SioRxBuf, SioDone, and SioUART.
  989.  
  990.  
  991.  
  992.  
  993.   +-------------+------------------------------------------------------------+
  994.   |    SioRI    |  Reads the Ring Indicator (RI) modem status bit.           |
  995.   +-------------+------------------------------------------------------------+
  996.  
  997.  
  998.     Syntax    int SioRI(int Port)
  999.               /* Port: Port selected (COM1 thru COM20) */
  1000.  
  1001.    Remarks    The SioRI function is used to read the Ring  Indicator
  1002.               (RI) modem status bit. Also see SioModem.
  1003.  
  1004.    Returns    -2 : Port not enabled. Call SioReset first.
  1005.               -4 : No such port.  Expect 0 to MaxPort.
  1006.                0 : RI is clear.
  1007.               >0 : RI is set (RING has occurred).
  1008.  
  1009.   See Also    SioDSR, SioCTS, SioDCD, and SioModem.
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  PCL4W Reference Manual                                            Page 15
  1021.   +-------------+------------------------------------------------------------+
  1022.   |    SioRTS   |  Sets, clears, or reads the Request to Send (RTS) line.    |
  1023.   +-------------+------------------------------------------------------------+
  1024.  
  1025.  
  1026.     Syntax    int SioRTS(Port, char Cmd)
  1027.               /* Port: Port selected (COM1 thru COM20) */
  1028.               /* Cmd:  RTS command (SET, CLEAR, or READ) */
  1029.  
  1030.    Remarks    The SioRTS function controls the Request to Send (RTS bit in the
  1031.               modem control register.
  1032.  
  1033.               The  RTS  line  is  used  by  some  error  correcting  modems to
  1034.               implement hardware flow control.  RTS is dropped by the computer
  1035.               to signal the modem not to send data, and is  raised  to  signal
  1036.               the modem to continue. RTS should be set when communicating with
  1037.               a modem unless Flow Control is being used.
  1038.  
  1039.               Refer  to  the  User's  Manual for a discussion of flow control.
  1040.               Commands (defined in PCL4W.H) are:
  1041.  
  1042.               SET_LINE ('S')   - set RTS (ON)
  1043.               CLEAR_LINE ('C') - clear RTS (OFF)
  1044.               READ_LINE ('R')  - read RTS
  1045.  
  1046.    Returns    -2 : Port not enabled. Call SioReset first.
  1047.               -4 : No such port. Expect 0 to MaxPort.
  1048.               -5 : Command is not one of 'S', 'C', or 'R'.
  1049.                0 : RTS is OFF (READ_LINE Command).
  1050.               >0 : RTS is ON  (READ_LINE Command).
  1051.  
  1052.   See Also    SioFlow and SioDTR.
  1053.  
  1054.  
  1055.   +------------+-------------------------------------------------------------+
  1056.   |  SioRxBuf  |  Sets up receive buffers.                                   |
  1057.   +------------+-------------------------------------------------------------+
  1058.  
  1059.  
  1060.     Syntax    int SioRxBuf(int Port,int Selector,SizeCode)
  1061.               /* Port:     Port selected (COM1 thru COM20) */
  1062.               /* Selector: Receive buffer selector */
  1063.               /* SizeCode: Buffer size code */
  1064.  
  1065.    Remarks     The  SioRxBuf  function passes the address selector and size of
  1066.               the receive buffer to  PCL4W.   Recall  that  PCL4W  requires  a
  1067.               receive buffer for each port in simultaneous operation since the
  1068.               receive  function is interrupt driven.  It must be called before
  1069.               any incoming characters can be received. SioRxBuf must be called
  1070.               before SioReset.  Buffer size codes are listed in "PCL4W.H".
  1071.  
  1072.               Size Code       Buffer Size    PCL4W.H Name
  1073.                  4            128 bytes        Size128
  1074.                  5            256 bytes        Size256
  1075.                  6            512 bytes        Size512
  1076.                  7           1024 bytes        Size1024 or Size1K
  1077.                  8           2048 bytes        Size2048 or Size2K
  1078.                  9           4096 bytes        Size4096 or Size4K
  1079.                 10           8192 bytes        Size8192 or Size8K
  1080.                 11          16384 bytes        Size16384 or Size16K
  1081.                 12          32768 bytes        Size32768 or Size32K
  1082.  
  1083.    Returns    -4 : No such port. Expect 0 to MaxPort.
  1084.              -10 : Bad buffer size code. Expecting 0 to 11.
  1085.  
  1086.   See Also    SioReset and Code Examples.
  1087.  
  1088.  PCL4W Reference Manual                                            Page 16
  1089.   +------------+-------------------------------------------------------------+
  1090.   | SioRxFlush |  Flushes (clears) the receive buffer.                       |
  1091.   +------------+-------------------------------------------------------------+
  1092.  
  1093.  
  1094.     Syntax    int SioRxFlush(int Port)
  1095.               /* Port: Port selected (COM1 thru COM20) */
  1096.  
  1097.    Remarks    The SioRxFlush  function  will  delete  any  characters  in  the
  1098.               receive  buffer  for  the  specified port.  After execution, the
  1099.               receive buffer will be empty.  Call SioRxBuf after  resetting  a
  1100.               port in order to delete any spurious characters.
  1101.  
  1102.    Returns    -2 : Port not enabled. Call SioReset first.
  1103.               -4 : No such port. Expect 0 to MaxPort.
  1104.  
  1105.   See Also    SioRxQue.
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.   +-------------+------------------------------------------------------------+
  1119.   |  SioRxQue   |  Returns the number of bytes in the receive queue.         |
  1120.   +-------------+------------------------------------------------------------+
  1121.  
  1122.  
  1123.     Syntax    int SioRxQue(int Port)
  1124.               /* Port: Port selected (COM1 thru COM20) */
  1125.  
  1126.    Remarks    The  SioRxQue  function  will return the number of characters in
  1127.               the receive queue at the time of the call. It  can  be  used  to
  1128.               implement XON/XOFF flow control.
  1129.  
  1130.    Returns    -2 : Port not enabled. Call SioReset first.
  1131.               -4 : No such port. Expect 0 to MaxPort.
  1132.  
  1133.   See Also     SioRxFlush.
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  PCL4W Reference Manual                                            Page 17
  1157.   +------------+-------------------------------------------------------------+
  1158.   |  SioTxBuf  |  Sets up transmitter buffer.                                |
  1159.   +------------+-------------------------------------------------------------+
  1160.  
  1161.  
  1162.     Syntax    int SioTxBuf(int Port,int Selector,int SizeCode)
  1163.               /* Port:     Port selected (COM1 thru COM20) */
  1164.               /* Selector: Receive buffer selector */
  1165.               /* SizeCode: Buffer size code */
  1166.  
  1167.  
  1168.    Remarks     The  SioTxBuf  function passes the address selector and size of
  1169.               the transmit buffer to PCL4W, provided that you will link with a
  1170.               PCL4W  library  with  transmitter  interrupts  enabled.    PCL4W
  1171.               requires  a  transmit  buffer  for  each  port  in  simultaneous
  1172.               operation if you are using  the  version  of  the  library  with
  1173.               transmitter interrupts enabled (PCL4W2.LIB).  SioTxBuf() must be
  1174.               called before SioReset.
  1175.  
  1176.               Size Code       Buffer Size    PCL4W.H Name
  1177.                  4            128 bytes        Size128
  1178.                  5            256 bytes        Size256
  1179.                  6            512 bytes        Size512
  1180.                  7           1024 bytes        Size1024 or Size1K
  1181.                  8           2048 bytes        Size2048 or Size2K
  1182.                  9           4096 bytes        Size4096 or Size4K
  1183.                 10           8192 bytes        Size8192 or Size8K
  1184.                 11          16384 bytes        Size16384 or Size16K
  1185.                 12          32768 bytes        Size32768 or Size32K
  1186.  
  1187.               This function is not used unless the transmitter interrupts  are
  1188.               enabled  (PCL4W2.LIB).  Refer  to  the  PCL4W  Users  Manual for
  1189.               information on transmitter (TX) interrupts.
  1190.  
  1191.    Returns     -4 : No such port. Expect 0 to MaxPort.
  1192.               -10 : Bad buffer size code. Expecting 0 to 11.
  1193.  
  1194.   See Also    SioRxBuf, SioReset and Code Examples.
  1195.  
  1196.  
  1197.   +------------+-------------------------------------------------------------+
  1198.   | SioTxFlush |  Flushes (clears) the transmitter buffer.                   |
  1199.   +------------+-------------------------------------------------------------+
  1200.  
  1201.  
  1202.     Syntax    int SioTxFlush(int Port)
  1203.               /* Port: Port selected (COM1 thru COM20) */
  1204.  
  1205.    Remarks    The SioTxFlush  function  will  delete  any  characters  in  the
  1206.               transmit  buffer  for the specified port, provided that you will
  1207.               link with a PCL4W library with transmitter  interrupts  enabled.
  1208.               After execution, the transmit buffer will be empty.
  1209.  
  1210.               Once  this  function is called, any character  in  the  transmit
  1211.               buffer  (put  there  by  SioPutc) will be lost and therefore not
  1212.               transmitted. This function is not used  unless  the  transmitter
  1213.               interrupts  are  enabled  Refer  to  the  PCL4W Users Manual for
  1214.               information on transmitter (TX) interrupts.
  1215.  
  1216.    Returns    -2 : Port not enabled. Call SioReset first.
  1217.               -4 : No such port. Expect 0 to MaxPort.
  1218.  
  1219.   See Also    SioTxQue.
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  PCL4W Reference Manual                                            Page 18
  1225.   +------------+-------------------------------------------------------------+
  1226.   |  SioTxQue  |  Returns the number of bytes in the transmit queue.         |
  1227.   +------------+-------------------------------------------------------------+
  1228.  
  1229.  
  1230.     Syntax    int SioTxQue(int Port)
  1231.               /* Port: Port selected (COM1 thru COM20) */
  1232.  
  1233.    Remarks    The SioTxQue function will return the number  of  characters  in
  1234.               the  transmit  queue  at the time of the call, provided that you
  1235.               will link with  a  PCL4W  library  with  transmitter  interrupts
  1236.               enabled.
  1237.  
  1238.               This function is not used unless the transmitter interrupts  are
  1239.               enabled.  Refer  to  the  PCL4W  Users Manual for information on
  1240.               transmitter (TX) interrupts.
  1241.  
  1242.    Returns    -2 : Port not enabled. Call SioReset first.
  1243.               -4 : No such port. Expect 0 to MaxPort.
  1244.  
  1245.   See Also     SioTxFlush.
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.   +------------+-------------------------------------------------------------+
  1254.   |  SioUART   |  Sets the UART base address.                                |
  1255.   +------------+-------------------------------------------------------------+
  1256.  
  1257.  
  1258.     Syntax    int SioUART(int Port,int Address)
  1259.               /* Port:    Port selected (COM1 thru COM20) */
  1260.               /* Address: UART address */
  1261.  
  1262.    Remarks    The  SioUART  function  sets  the  UART  base  address  for  the
  1263.               specified port.  SioUART must be called before SioReset in order
  1264.               to have effect.  Be extremely sure that you know  what  you  are
  1265.               doing!   Note   that  PCL4W  uses  the  standard  PC/XT/AT  port
  1266.               addresses,  interrupt  request  lines,  and  interrupt   service
  1267.               vectors.   Therefore,   this   function   is   only  needed  for
  1268.               non-standard ports.
  1269.  
  1270.    Returns    >0 : The previous base address for this port.
  1271.               -4 : No such port.  Expect 0 to MaxPort.
  1272.              -15 : Port already enabled.  SioReset has already been called.
  1273.  
  1274.   See Also    SioPorts, SioIRQ, and SioReset.
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  PCL4W Reference Manual                                            Page 19
  1293.   +------------+-----+-------------------------------------------------------+
  1294.   | SioUnGetc  |  "Un|gets" the last character read with SioGetc().          |
  1295.   +------------+-----+-------------------------------------------------------+
  1296.  
  1297.  
  1298.     Syntax    int SioUnGetc(int Port,char Ch)
  1299.               /* Port: Port selected (COM1 thru COM20) */
  1300.               /* Ch:   Character to unget */
  1301.  
  1302.    Remarks    The SioUnGetc function returns  ("pushes")  the  character  back
  1303.               into  the serial input buffer.  The character pushed will be the
  1304.               next character returned by SioGetc.  Only one character  can  be
  1305.               pushed back. This function works just like the "ungetc" function
  1306.               in the C language.
  1307.  
  1308.    Returns    -2 : Port not enabled. Call SioReset first.
  1309.               -4 : No such port. Expect 0 to MaxPort.
  1310.  
  1311.   See Also    SioReset.
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  PCL4W Reference Manual                                            Page 20
  1361.                            Function Sumary
  1362.  
  1363.  
  1364.  
  1365.        +-------------+----------+----------+----------+----------+
  1366.        | Function    |   Arg1   |   Arg2   |   Arg3   |   Arg4   |
  1367.        +-------------+----------+----------+----------+----------+
  1368.        | SioBaud     | Port     | BaudCode |          |          |
  1369.        | SioBrkSig   | Port     | Cmd      |          |          |
  1370.        | SioCTS      | Port     |          |          |          |
  1371.        | SioDCD      | Port     |          |          |          |
  1372.        | SioDone     | Port     |          |          |          |
  1373.        | SioDSR      | Port     |          |          |          |
  1374.        | SioDTR      | Port     | Cmd      |          |          |
  1375.        | SioError    | Code     |          |          |          |
  1376.        | SioFIFO     | Port     | FIFOcode |          |          |
  1377.        | SioFlow     | Port     |          |          |          |
  1378.        | SioGetDiv   | Port     |          |          |          |
  1379.        | SioGetc     | Port     |          |          |          |
  1380.        | SioInfo     | Cmd      |          |          |          |
  1381.        | SioIRQ      | Port     | IRQcode  | ISRcode  |          |
  1382.        | SioLine     | Port     |          |          |          |
  1383.        | SioLoopBack | Port     |          |          |          |
  1384.        | SioModem    | Port     | Mask     |          |          |
  1385.        | SioParms    | Port     | Parity   | StopBits |WordLength|
  1386.        | SioPorts    | NbrPorts | FirstDBP |StatusReg | Code     |
  1387.        | SioPutc     | Port     | Ch       |          |          |
  1388.        | SioRead     | Port     | Register |          |          |
  1389.        | SioReset    | Port     | BaudCode |          |          |
  1390.        | SioRI       | Port     |          |          |          |
  1391.        | SioRTS      | Port     | Cmd      |          |          |
  1392.        | SioRxBuf    | Port     | Buffer   | SizeCode |          |
  1393.        | SioRxFlush  | Port     |          |          |          |
  1394.        | SioRxQue    | Port     |          |          |          |
  1395.        | SioTxBuf    | Port     | Buffer   | SizeCode |          |
  1396.        | SioTxFlush  | Port     |          |          |          |
  1397.        | SioTxQue    | Port     |          |          |          |
  1398.        | SioUART     | Port     | Address  |          |          |
  1399.        | SioUnGetc   | Port     | Ch       |          |          |
  1400.        +-------------+----------+----------+----------+----------+
  1401.  
  1402.  
  1403.  
  1404.  
  1405.  
  1406.  
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  PCL4W Reference Manual                                            Page 21
  1429.                            Error Code Summary
  1430.  
  1431.  
  1432.  
  1433.   +------+--------------------------------------------------------+
  1434.   | Code |  Description                                           |
  1435.   +------+--------------------------------------------------------+
  1436.   |   0  |  No error.                                             |
  1437.   |  -1  |  Timeout waiting for I/O.                              |
  1438.   |  -2  |  Port not enabled. Call SioReset first.                |
  1439.   |  -3  |  No buffer available. Call SioRxBuf first.             |
  1440.   |  -4  |  No such port. Expect 0 to MaxPort. (COM1 = 0)         |
  1441.   |  -5  |  Expected 'S', 'C', or 'R' as 2nd argument.            |
  1442.   |  -6  |  Expected 'A', 'C', or 'D' as 2nd argument.            |
  1443.   |  -7  |  Bad parity code specified. Expected 0 to 7.           |
  1444.   |  -8  |  Bad stop bits code specified. Expected 0 or 1.        |
  1445.   |  -9  |  Bad wordlength code specified. Expect 0 to MaxPort.   |
  1446.   | -10  |  Bad buffer size code specified. Expected 0 to 11.     |
  1447.   | -11  |  Bad baud rate code. Expected 0 to 9.                  |
  1448.   | -12  |  Loopback test fails.                                  |
  1449.   | -13  |  UART undefined.                                       |
  1450.   | -14  |  Missing or bad UART. (no UART hardware ?)             |
  1451.   | -15  |  Port already enabled.                                 |
  1452.   | -16  |  ISR (interrupt) already in use.                       |
  1453.   | -17  |  No such IRQ. (Should be 2 to 15)                      |
  1454.   | -18  |  ISR limit (maximum of 4 PC IRQs) exceeded.            |
  1455.   | -19  |  Failed to call PostMainHandle before SioReset.        |
  1456.   +------+--------------------------------------------------------+
  1457.  
  1458.  
  1459.                            Code Examples
  1460.  
  1461.  
  1462.   SioRxBuf() Example
  1463.  
  1464.   dwValue = GlobalDosAlloc(1024));
  1465.   if(dwValue)
  1466.     {/* get selector & lock */
  1467.      RxSelector = LOWORD(dwValue);
  1468.      GlobalPageLock(RxSelector);
  1469.      /* pass selector to PCL4W */
  1470.      SioRxBuf(Port,RxSelector,Size1024);
  1471.     }
  1472.  
  1473.   DigiBoard Example
  1474.  
  1475.   /* use 0x140 for odd IRQs & 0x141 for even IRQs */
  1476.   SioPorts(8,COM1,0x140,DIGIBOARD);
  1477.   for(i=COM1;i<=COM20;i++)
  1478.     {/* set DigiBoard UART addresses */
  1479.      SioUART(i,0x100+8*i);
  1480.      /* set DigiBoard for IRQ5 */
  1481.      SioIRQ(i,IRQ5);
  1482.     }
  1483.  
  1484.   BOCA Board Example
  1485.  
  1486.   /* use base port + 7 */
  1487.   SioPorts(16,COM1,0x100+7,BOCABOARD);
  1488.   for(i=COM1;i<=COM16;i++)
  1489.     {/* set BOCA Board UART addresses */
  1490.      SioUART(i,0x100+8*i);
  1491.      /* set DigiBoard for IRQ15 */
  1492.      SioIRQ(i,IRQ15);
  1493.     }
  1494.  
  1495.  
  1496.  PCL4W Reference Manual                                            Page 22
  1497.